{template 'common/header'}
	<ul class="nav nav-tabs">
		<li class="active">
			<a href="#" >二手交易管理</a>
		</li>
		 <li><a href="{php echo $this->createWebUrl('fled', array('op'=>'category'));}">服务分类</a></li>
	</ul>
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
			{if !$user}
				<div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 control-label">选择小区</label>
                    <div class="col-sm-3 col-md-3 col-lg-3 col-xs-3">
                        <select name="regionid" class="form-control">
                                {loop $regions $region}
                                <option value="{$region['id']}" {if $region['id']==$_GPC[ 'regionid']} selected{/if}>{$region['title']}</option>
                                {/loop}
                        </select>
                    </div>
                </div>
            {/if}
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">二手分类</label>
					<div class="col-sm-3 col-md-3 col-lg-3 col-xs-3">
						<select class="form-control" id="cate_2" name="category">
							<option value="0">请选择二手分类</option>
							{loop $categories $key $category}
							<option value="{$category['id']}" {if $category['id'] == $_GPC['category']} selected="selected"{/if}>{$category['name']}</option>
							{/loop}
						</select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">状态</label>
					<div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
						<label for="ipt_status1" class="radio-inline">
							<input name="status" id="ipt_status1" type="radio" value="0" {if empty($_GPC['status'])}checked='checked'{/if} />未成交
						</label>
						<label for="ipt_status2" class="radio-inline">
							<input name="status" id="ipt_status2" type="radio" value="1" {if $_GPC['status'] == 1}checked='checked'{/if} />已成交
						</label>
					</div>
				</div>
				<div class="form-group">
					<div class="pull-right col-xs-12 col-sm-2 col-md-2 col-lg-2">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
					<th class="col-sm-1">编号</th>
					<th class="col-sm-2">名称</th>
					<th class="col-sm-2">价格</th>
					<th class="col-sm-2">联系人</th>
					<th class="col-sm-2">所属小区</th>
					<th class="col-sm-2">联系电话</th>
					<th class="col-sm-3">发布时间</th>
					<th class="col-sm-5">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $good}
				<tr>
					<td>{$good['id']}</td>
					<td>{$good['title']}</td>
					<td>{if empty($good['zprice'])}面议{else}{$good['zprice']}元{/if}</td>
					<td>{$good['realname']}</td>
					<td>{$good['city']}{$good['dist']}{$good['rtitle']}</td>
					<td>{$good['mobile']}</td>
					<td>{php echo date('Y-m-d H:i',$good['createtime'])}</td>
					<td>
						<a href="{php echo $this->createWebUrl('fled',array('op' => 'detail','id'=>$good['id']))}" class="btn btn-primary btn-sm" ><i class="glyphicon glyphicon-search"></i>查看
						</a>&nbsp;
						<a href="javascript:;" data="{$good['id']}" title="删除" class="btn btn-primary btn-sm" id='del'><i class="fa fa-times"></i>删除
						</a>&nbsp;
						<a onclick="toblack('{$good['id']}')" href="#" class="btn btn-primary btn-sm"><i class="fa fa-eye-slash"></i>信息加入黑名单</a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
	</div>
	{$pager}
	<script type="text/javascript">
	    $(function () {
	        $("#del").bind("click",function(){
	            var id = $(this).attr('data');
		        var url = "{php echo $this->createWebUrl('fled',array('op' => 'delete'),true)}";
		            $.post(url,
		            {
		                id:id
		            },
		            function(msg){
		                    if (msg.status == 1) {
		                    	setTimeout(function(){
		                        	window.location.reload();
		                   		 },100);
		                    };
		                    
		            },
		            'json');
	        });
		});
    	function toblack(id){
	    	var id = id;
	            if(!id) return false;
	            $.post("{php echo $this->createWebUrl('fled')}", {"op":"toblack","id":id}, function(msg){
	                var _obj = JSON.parse(msg);
	                if(_obj.state==1){
	                   location.reload();
	                }
	            });
	    }
	</script>
{template 'common/footer'}